<template>
  <div class="access-container">
    <el-card>
      <div class="name">
        姓名/身份证
      </div>
      <el-row :gutter="20">
        <el-col :span="6">
          <el-input
            v-model="inputValue"
            placeholder="请输入内容"
          />
        </el-col>
        <el-col :span="6">
          <el-button type="primary">
            查询
          </el-button>
        </el-col>
      </el-row>
      <el-table
        :data="tableData"
        style="width: 100%"
        :header-cell-style="{background:'#ebecf0',color:'#3b3c3c'}"
      >
        <el-table-column
          type="selection"
          width="55"
        />
        <el-table-column
          type="index"
          label="序号"
        />
        <el-table-column
          prop="name"
          label="姓名"
        />
        <el-table-column
          prop="date"
          label="身份证号"
        />
        <el-table-column
          prop="date"
          label="时间"
        />
        <el-table-column
          prop="location"
          label="位置"
        />
        <el-table-column
          prop="types"
          label="类型"
        />
        <el-table-column label="操作">
          <template>
            <div class="checks">
              查看
            </div>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
        :current-page="queryInfo.pagenum"
        :page-sizes="[1, 3, 5, 10]"
        :page-size="queryInfo.pagesize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      />
    </el-card>
  </div>
</template>

<script>
import { mapGetters } from "vuex";

export default {
  name: "Door",
  data() {
    return {
      inputValue: "",
      tableData: [
        {
          date: "2016-05-02",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄",
          location: "南大门",
          types: "出"
        },
        {
          date: "2016-05-04",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1517 弄",
          location: "南大门",
          types: "出"
        },
        {
          date: "2016-05-01",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1519 弄",
          location: "南大门",
          types: "出"
        }
      ],
      queryInfo: {
        query: "",
        pagenum: 1,
        pagesize: 1
      },
      total: 3
    };
  },
  computed: {
    ...mapGetters(["roles", "communityId"])
  },
  watch: {
    communityId(newVal, oldVal) {
      console.log("changed");
    }
  },
  created() {},
  methods: {
    handleSizeChange(val) {
      console.log(val);
      this.queryInfo.pagesize = val;
    },
    handleCurrentChange(val) {
      console.log(val);
      this.queryInfo.pagenum = val;
    }
  }
};
</script>

<style scoped>
.name {
  margin: 18px 0 8px 3px;
  font-size: 16px;
}
.el-table {
  margin-top: 40px;
}
.el-pagination {
  float: right;
  margin-top: 200px;
}
</style>
